package com.yxplearn.mybatisplus.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.yxplearn.mybatisplus.mapper.ConfigDataMapper;
import com.yxplearn.mybatisplus.mapper.TConfigDataMapper;
import com.yxplearn.mybatisplus.mapper.UserMapper;
import com.yxplearn.mybatisplus.pojo.ConfigData;
import com.yxplearn.mybatisplus.pojo.TConfigData;
import com.yxplearn.mybatisplus.pojo.User;

@Component
public class ControllerTest {
	@Autowired
	UserMapper userMapper;
	
	@Autowired
	ConfigDataMapper configDataMapper; 
	
	@Autowired
	TConfigDataMapper tConfigDataMapper; 

	public void testSelectList() {
		List<User> users = userMapper.selectList(null);
		users.forEach(System.out::println);
	}
	
	public void testInsertUser() {
		User user = new User();
		user.setAge(1);
		user.setEmail("tes");
		user.setName("ffasf");
		System.out.println(userMapper.insert(user));
	}
	
	public void testSelectConfigList() {
		List<ConfigData> configData = configDataMapper.selectList(null);
		configData.forEach(System.out::println);
	}
	
	public void testInsertConfigData() {
		ConfigData configData = new ConfigData();
		configData.setUserName("ff");
//		configData.setUpdateTime(new Date());
//		configData.setCreateTime(new Date());
	}
	
	public void testSelectTConfigList() {
		List<TConfigData> configData = tConfigDataMapper.selectList(null);
		configData.forEach(System.out::println);
	}
}
